from pymt import *
import gdata.photos.service
import gdata.media

# Create background window
w = getWindow()

print "Picasa.search"

gd_client = gdata.photos.service.PhotosService()
gd_client.email = "roomc78@gmail.com"
gd_client.password = "mtouch1977"
gd_client.source = 'uk.ac.napier.enice'
gd_client.ProgrammaticLogin()

# search and return details for just one photo
photos = gd_client.SearchCommunityPhotos("hello", limit=1)

for photo in photos.entry:
  print "URL:", photo.content.src, "height:", int(photo.height.text), "width:", int(photo.width.text)
  image = Loader.image(photo.content.src)
  w.add_widget(MTScatterImage(image=image))

runTouchApp()
